/**
 * This is my code.
 *
 * $Id$
 */
package fi.jab.esb.config.xml.impl;

import fi.jab.esb.config.xml.ActivationConfigType;
import fi.jab.esb.config.xml.JcaGatewayType;
import fi.jab.esb.config.xml.XmlPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Jca Gateway Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fi.jab.esb.config.xml.impl.JcaGatewayTypeImpl#getActivationConfig <em>Activation Config</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JcaGatewayTypeImpl#getAdapter <em>Adapter</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JcaGatewayTypeImpl#getEndpointClass <em>Endpoint Class</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JcaGatewayTypeImpl#getJcaBridge <em>Jca Bridge</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JcaGatewayTypeImpl#getMessagingType <em>Messaging Type</em>}</li>
 *   <li>{@link fi.jab.esb.config.xml.impl.JcaGatewayTypeImpl#getTransacted <em>Transacted</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class JcaGatewayTypeImpl extends ListenerImpl implements JcaGatewayType
{
  /**
   * The cached value of the '{@link #getActivationConfig() <em>Activation Config</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getActivationConfig()
   * @generated
   * @ordered
   */
  protected ActivationConfigType activationConfig;

  /**
   * The default value of the '{@link #getAdapter() <em>Adapter</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAdapter()
   * @generated
   * @ordered
   */
  protected static final String ADAPTER_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getAdapter() <em>Adapter</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAdapter()
   * @generated
   * @ordered
   */
  protected String adapter = ADAPTER_EDEFAULT;

  /**
   * The default value of the '{@link #getEndpointClass() <em>Endpoint Class</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEndpointClass()
   * @generated
   * @ordered
   */
  protected static final String ENDPOINT_CLASS_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getEndpointClass() <em>Endpoint Class</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEndpointClass()
   * @generated
   * @ordered
   */
  protected String endpointClass = ENDPOINT_CLASS_EDEFAULT;

  /**
   * The default value of the '{@link #getJcaBridge() <em>Jca Bridge</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getJcaBridge()
   * @generated
   * @ordered
   */
  protected static final String JCA_BRIDGE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getJcaBridge() <em>Jca Bridge</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getJcaBridge()
   * @generated
   * @ordered
   */
  protected String jcaBridge = JCA_BRIDGE_EDEFAULT;

  /**
   * The default value of the '{@link #getMessagingType() <em>Messaging Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMessagingType()
   * @generated
   * @ordered
   */
  protected static final String MESSAGING_TYPE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getMessagingType() <em>Messaging Type</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMessagingType()
   * @generated
   * @ordered
   */
  protected String messagingType = MESSAGING_TYPE_EDEFAULT;

  /**
   * The default value of the '{@link #getTransacted() <em>Transacted</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTransacted()
   * @generated
   * @ordered
   */
  protected static final String TRANSACTED_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getTransacted() <em>Transacted</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTransacted()
   * @generated
   * @ordered
   */
  protected String transacted = TRANSACTED_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected JcaGatewayTypeImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XmlPackage.Literals.JCA_GATEWAY_TYPE;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ActivationConfigType getActivationConfig()
  {
    return activationConfig;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetActivationConfig(ActivationConfigType newActivationConfig, NotificationChain msgs)
  {
    ActivationConfigType oldActivationConfig = activationConfig;
    activationConfig = newActivationConfig;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG, oldActivationConfig, newActivationConfig);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setActivationConfig(ActivationConfigType newActivationConfig)
  {
    if (newActivationConfig != activationConfig)
    {
      NotificationChain msgs = null;
      if (activationConfig != null)
        msgs = ((InternalEObject)activationConfig).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG, null, msgs);
      if (newActivationConfig != null)
        msgs = ((InternalEObject)newActivationConfig).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG, null, msgs);
      msgs = basicSetActivationConfig(newActivationConfig, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG, newActivationConfig, newActivationConfig));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getAdapter()
  {
    return adapter;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAdapter(String newAdapter)
  {
    String oldAdapter = adapter;
    adapter = newAdapter;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JCA_GATEWAY_TYPE__ADAPTER, oldAdapter, adapter));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getEndpointClass()
  {
    return endpointClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEndpointClass(String newEndpointClass)
  {
    String oldEndpointClass = endpointClass;
    endpointClass = newEndpointClass;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JCA_GATEWAY_TYPE__ENDPOINT_CLASS, oldEndpointClass, endpointClass));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getJcaBridge()
  {
    return jcaBridge;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setJcaBridge(String newJcaBridge)
  {
    String oldJcaBridge = jcaBridge;
    jcaBridge = newJcaBridge;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JCA_GATEWAY_TYPE__JCA_BRIDGE, oldJcaBridge, jcaBridge));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getMessagingType()
  {
    return messagingType;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMessagingType(String newMessagingType)
  {
    String oldMessagingType = messagingType;
    messagingType = newMessagingType;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JCA_GATEWAY_TYPE__MESSAGING_TYPE, oldMessagingType, messagingType));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getTransacted()
  {
    return transacted;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTransacted(String newTransacted)
  {
    String oldTransacted = transacted;
    transacted = newTransacted;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.JCA_GATEWAY_TYPE__TRANSACTED, oldTransacted, transacted));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG:
        return basicSetActivationConfig(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG:
        return getActivationConfig();
      case XmlPackage.JCA_GATEWAY_TYPE__ADAPTER:
        return getAdapter();
      case XmlPackage.JCA_GATEWAY_TYPE__ENDPOINT_CLASS:
        return getEndpointClass();
      case XmlPackage.JCA_GATEWAY_TYPE__JCA_BRIDGE:
        return getJcaBridge();
      case XmlPackage.JCA_GATEWAY_TYPE__MESSAGING_TYPE:
        return getMessagingType();
      case XmlPackage.JCA_GATEWAY_TYPE__TRANSACTED:
        return getTransacted();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG:
        setActivationConfig((ActivationConfigType)newValue);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__ADAPTER:
        setAdapter((String)newValue);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__ENDPOINT_CLASS:
        setEndpointClass((String)newValue);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__JCA_BRIDGE:
        setJcaBridge((String)newValue);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__MESSAGING_TYPE:
        setMessagingType((String)newValue);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__TRANSACTED:
        setTransacted((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG:
        setActivationConfig((ActivationConfigType)null);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__ADAPTER:
        setAdapter(ADAPTER_EDEFAULT);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__ENDPOINT_CLASS:
        setEndpointClass(ENDPOINT_CLASS_EDEFAULT);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__JCA_BRIDGE:
        setJcaBridge(JCA_BRIDGE_EDEFAULT);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__MESSAGING_TYPE:
        setMessagingType(MESSAGING_TYPE_EDEFAULT);
        return;
      case XmlPackage.JCA_GATEWAY_TYPE__TRANSACTED:
        setTransacted(TRANSACTED_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XmlPackage.JCA_GATEWAY_TYPE__ACTIVATION_CONFIG:
        return activationConfig != null;
      case XmlPackage.JCA_GATEWAY_TYPE__ADAPTER:
        return ADAPTER_EDEFAULT == null ? adapter != null : !ADAPTER_EDEFAULT.equals(adapter);
      case XmlPackage.JCA_GATEWAY_TYPE__ENDPOINT_CLASS:
        return ENDPOINT_CLASS_EDEFAULT == null ? endpointClass != null : !ENDPOINT_CLASS_EDEFAULT.equals(endpointClass);
      case XmlPackage.JCA_GATEWAY_TYPE__JCA_BRIDGE:
        return JCA_BRIDGE_EDEFAULT == null ? jcaBridge != null : !JCA_BRIDGE_EDEFAULT.equals(jcaBridge);
      case XmlPackage.JCA_GATEWAY_TYPE__MESSAGING_TYPE:
        return MESSAGING_TYPE_EDEFAULT == null ? messagingType != null : !MESSAGING_TYPE_EDEFAULT.equals(messagingType);
      case XmlPackage.JCA_GATEWAY_TYPE__TRANSACTED:
        return TRANSACTED_EDEFAULT == null ? transacted != null : !TRANSACTED_EDEFAULT.equals(transacted);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (adapter: ");
    result.append(adapter);
    result.append(", endpointClass: ");
    result.append(endpointClass);
    result.append(", jcaBridge: ");
    result.append(jcaBridge);
    result.append(", messagingType: ");
    result.append(messagingType);
    result.append(", transacted: ");
    result.append(transacted);
    result.append(')');
    return result.toString();
  }

} //JcaGatewayTypeImpl
